package com.example.lenovo.demo.view;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.example.lenovo.demo.R;
import com.example.lenovo.demo.presenter.CityHotFgPresenter;
import com.example.lenovo.demo.view.ifgview.ICityHotFragment;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

/**
 * Created by Lenovo on 2017/1/11.
 */
@ContentView(R.layout.fragment_city_hot)
public class CityHotFragment extends Fragment implements ICityHotFragment{
    private View view;
    private String area;
    private ProgressDialog progressDialog;
    private CityHotFgPresenter cityHotFgPresenter;


    @ViewInject(R.id.cityhot_lv)
    private ListView listView;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view= x.view().inject(this,inflater,container);
        init();
        return view;
    }
    private void init() {
        area=getArguments().getString("msg");
        cityHotFgPresenter=new CityHotFgPresenter(this);
        progressDialog=new ProgressDialog(getActivity());
        progressDialog.setTitle("提示");
        progressDialog.setMessage("正在加载...");
        progressDialog.setCancelable(true);
        cityHotFgPresenter.initData();
    }

    @Override
    public String getArea() {
        return area;
    }

    @Override
    public ListView getLv() {
        return listView;
    }

    @Override
    public Context getCityHotContext() {
        return getActivity();
    }

    @Override
    public ProgressDialog getProgressDialog() {
        return progressDialog;
    }

}
